#ifndef IMMEDIATEUPDATESTRATEGY_H
#define IMMEDIATEUPDATESTRATEGY_H

#include "istatusupdatestrategy.h"
#include <QDebug>

class StatusBarManager;

/**
 * ImmediateUpdateStrategy - 即时更新策略
 *
 * Martin Fowler重构：Strategy Pattern Implementation
 * 状态变化立即反映到UI，不进行缓存或延迟
 *
 * 适用于：
 * - 对响应性要求高的场景
 * - 状态变化不频繁的情况
 * - 调试和开发阶段
 */
class ImmediateUpdateStrategy : public IStatusUpdateStrategy
{
public:
    explicit ImmediateUpdateStrategy(StatusBarManager* statusBarManager = nullptr)
        : m_statusBarManager(statusBarManager)
    {
    }

    void setStatusBarManager(StatusBarManager* statusBarManager) {
        m_statusBarManager = statusBarManager;
    }

    // IStatusUpdateStrategy interface
    void applyUpdate(const StatusBarState& newState,
                    const StatusBarState& oldState,
                    void* context = nullptr) override;

    QString strategyName() const override {
        return "ImmediateUpdate";
    }

    bool supportsBatchUpdate() const override {
        return false;
    }

private:
    StatusBarManager* m_statusBarManager;
};

#endif // IMMEDIATEUPDATESTRATEGY_H